WEBVTT

00:01.250 --> 00:07.940
Welcome to coding exercise 50 and are the tuba that s part and our exercises file is still on the desktop

00:08.510 --> 00:16.960
and we have free finance data exercises and to be on par to financial data analysis and now let's hope

00:17.080 --> 00:18.640
exercise 15

00:21.550 --> 00:27.160
and exercise 15 is all about creating analyzing and optimizing financial portfolios.

00:27.940 --> 00:34.440
So first of all you have to import the stocks dataset and select the five year period here.

00:34.540 --> 00:41.350
Then you should create 10000 random portfolios and the weights of the constituents of course have to

00:41.350 --> 00:49.330
sum up to one and all weights must be between 0 and 1 and you should actually use the NPD at random

00:49.330 --> 00:55.580
seed of 1 to 3 to get actually the very same results as I do in the solution.

00:55.750 --> 01:01.840
And then you should calculate annualized the risk and return for the six stocks and also for the 10000

01:01.840 --> 01:07.870
random portfolios and the calculation shall be based on daily returns simple returns and you should

01:07.870 --> 01:11.730
also visualize this here and to make life easier.

01:11.730 --> 01:16.870
You can also use the user defined function annualized risk and return.

01:17.140 --> 01:23.110
And then you should assume that the approximate risk free assets showed a return of one point seven

01:23.110 --> 01:24.020
percent.

01:24.130 --> 01:28.120
So this could be a five year U.S. Treasury note.

01:28.120 --> 01:34.120
And with this you can calculate the Sharpe ratio for the six stocks and for the 10000 random portfolios

01:34.390 --> 01:41.890
and you should also visualize this sharp ratio as the third dimension of the graph with different colors.

01:42.130 --> 01:49.000
And then you should also search for the max Sharpe rates for portfolio from the set of the 10000 random

01:49.000 --> 01:54.970
portfolios and determine risk return and Sharpe ratio and then finally you have to determine the weights

01:55.100 --> 01:58.270
for the constituents in the max to operate your portfolio.

01:58.630 --> 02:04.420
And if you are computing power allows for this you can also increase the number of random portfolios

02:04.420 --> 02:06.630
to for example 50000.

02:06.760 --> 02:11.130
And by doing so your results are getting more exact on more reliable.

02:11.320 --> 02:15.850
And then you might be able to answer the question of which stocks do you think have an actual rate of

02:15.970 --> 02:19.010
zero in the real Max operator portfolio.

02:19.270 --> 02:25.750
That can be derived with an optimization algorithm and it should also be able to identify highly concentrated

02:25.750 --> 02:28.430
position in one of the stocks.

02:28.600 --> 02:32.630
And of course you can also use the option to guided and instructed.

02:33.280 --> 02:41.650
And finally there's also some hints here at the very end so that's accounting exercise safety and I

02:41.650 --> 02:45.520
hope you have fun and feel free to have a look at the solution by.
